﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COM.Rights.Model;

namespace System.Web
{
    public class ZRSession : ZSession
    {
        public static Dictionary<string, TFunctionInfo> Functions
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["Functions"] != null)
                {
                    return System.Web.HttpContext.Current.Session["Functions"] as Dictionary<string, TFunctionInfo>;
                }
                else
                {
                    return null;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["Functions"] = value;
            }
        }

        public static TUserInfo UserInfo
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["TUserInfo"] != null)
                {
                    return System.Web.HttpContext.Current.Session["TUserInfo"] as TUserInfo;
                }
                else
                {
                    return null;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["TUserInfo"] = value;
            }
        }

        public static List<string> RoleNames
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["RoleNames"] != null)
                {
                    return System.Web.HttpContext.Current.Session["RoleNames"] as List<string>;
                }
                else
                {
                    return null;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["RoleNames"] = value;
            }
        }

        public static string ValidateCodeAdmin
        {
            get
            {
                if (System.Web.HttpContext.Current.Session != null && System.Web.HttpContext.Current.Session["ValidateCodeAdmin"] != null)
                {
                    return System.Web.HttpContext.Current.Session["ValidateCodeAdmin"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["ValidateCodeAdmin"] = value;
            }
        }
    }
}
